package leetcode;

import java.util.Scanner;

public class Day2 {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            String a = in.nextLine();
            StringBuilder stringBuilder=new StringBuilder();
            char s=a.substring(0,1).charAt(0);
            stringBuilder.append(s);
           for (int i=0;i<a.length()-1;i++){
               if(a.charAt(i)==' '){
                   stringBuilder.append(a.charAt(i+1));
               }
           }
          String result = stringBuilder.toString().toUpperCase();
            System.out.println(result);
        }
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int x = in.nextInt();
            int[] a = new int[n];
            for (int i=0;i<a.length;i++){
                a[i]=in.nextInt();
            }
            int l = 0;
            int r = a.length;
            int ret = a.length;
            for (int i = 0; i < a.length; i++) {
                int sum = 0;
                int j = i;
                while (j < a.length) {
                    sum += a[j];
                    if (sum > x && (j - i) < ret) {
                        l = i;
                        r = j;
                        ret = r - l;
                        return;
                    }
                    j++;
                }
            }
            System.out.println(l+" "+r);
        }
    }
}
